package cn.it.controller;

import cn.it.domain.Car;
import cn.it.services.CarServices;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CarController {

    @Autowired
    private CarServices carServices;
    @RequestMapping("/searchCarById")
    public Car searchCarById(Integer id){
        return carServices.searchCarById(id);
    }
    @RequestMapping("/selectAll")
    public List<Car> selectAll(){
        PageHelper.startPage(1,5);
        List<Car> cars = carServices.selectAll();
        return cars;
    }
}
